version: 2.1

# this allows you to use CircleCI's dynamic configuration feature
# (must be enabled in CircleCI's project settings as well)
setup: true

# the path-filtering orb is required to continue a pipeline based on
# the path of an updated fileset see https://circleci.com/docs/2.0/using-dynamic-configuration/
orbs:
  path-filtering: circleci/path-filtering@0.1.1
  continuation: circleci/continuation@0.3.1

# Can't add multiple workflows in setup since only one of these will run
# https://support.circleci.com/hc/en-us/articles/360060934851--Max-number-of-workflows-exceeded-error
workflows:
  circleci-main:
    jobs:
      # Test code
      - path-filtering/filter:
          name: launch-tests
          # Mapping format:
          # <file modified> <variable_name> <variable_value>
          mapping: |
            xformers/.* run-tests true
            setup.py run-tests true
            requirements.* run-tests true
            .circleci/.* run-tests true
          base-revision: main
          config-path: .circleci/continue_config.yml
          filters:
            branches:
              ignore:
                - gh-pages
                - /gh\/.+\/base/
                - /gh\/.+\/orig/
